package com.bdqn.mapper;

import com.bdqn.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DeptMapper {

    List<Dept> selectByName(String name);
    @Insert("insert into sys_dept values(null,#{deptName},#{regNumber},#{deptNumber},#{orderNum},#{deptLeader},#{leaderPhone},#{status},default,null,#{createBy},null)")
    int add(Dept dept);
    @Update("update sys_dept set dept_name=#{deptName},reg_number=#{regNumber},dept_number=#{deptNumber},order_num=#{orderNum},dept_leader=#{deptLeader},leader_phone=#{leaderPhone},status=#{status},update_time=default,update_by=#{updateBy} where dept_id=#{deptId}")
    int update(Dept dept);
    @Delete("delete from sys_dept where dept_id=#{deptId}")
    int delete(int id);
    @Update("update sys_dept set status=#{status} where dept_id=#{deptId}")
    int updateStatus(@Param("deptId") int deptId,@Param("status") String status);
}
